Use NSValues to put random C-types into collections.
Use NSNumbers to put numbers into collections.
*/
#import <foundation/NSObject.h>
#import <foundation/NSString.h>
/* An abstract class for wrapping any C-type with an object. Sample use: To put an NSRange into an NSArray, you would [myArray insertObject:[NSValue value:&range withObjCType:@encode(NSRange)] atIndex:n]; to get it back out, [[myArray objectAtIndex:n] getValue:&range].
- (void)getValue:(void *)value; /* Value copied from the object to caller's variable... */
- (const char *)objCType; /* Standard objC encoding string */
@end
@interface NSValue (NSValueOtherTypes)
+ (NSValue *)valueWithNonretainedObject:anObject; /* Get objects into collections without retain */
- nonretainedObjectValue;
+ (NSValue *)valueWithPointer:(void *)pointer; /* Get pointers into collections */
- (void *)pointerValue;
@end
/* An abstract class for wrapping C number types with an object. NSNumbers have the added feature that they can do type-coercion. The objCType method in an NSNumber can only be one of c, C, s, S, i, I, l, L, q, Q, f, or d.
*/
@interface NSNumber : NSValue
/* These methods return the number in the requested type. These methods will do type-coercion as defined by C. In certain cases the results may be undefined; for instance, trying to take the unsigned integer value of a negative number, or trying to get the short value of an float which is greater than the maximum short.